<%@ page language="java" import="com.pignest.hotel.beans.*" contentType="text/html; charset=utf-8" %>
<%@ page import="com.pignest.hotel.service.*" %>
<%@ page import="com.pignest.hotel.spring.Services" %>
<%@ page import="com.pignest.framework.util.*" %>
<%
String contextPath = request.getContextPath();
String roomId = request.getParameter("roomId");
String memberId= request.getParameter("memberId");
RoomService service = Services.getRoomService();
MemberService mService = Services.getMemberService();
Room room;
int memberPrice=0;
if (roomId == null) {
	String roomName = request.getParameter("roomName");
	room = service.getRoomByName(roomName);
} else {
	room = service.getRoom(roomId);
}
if(memberId!=null&&room!=null){
	memberPrice =mService.getMemberPrice(memberId,room.getType().getId());
}

boolean detail = room != null && "true".equals(request.getParameter("detail"));
if (room == null) {
%>
<%
} else {
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title> 房间: <%=room.getName() %> </title>
<%if (detail) { %>
<link rel="stylesheet" type="text/css" href="<%=contextPath%>/scripts/highslide/highslide.css" />
<script type="text/javascript" src="<%=contextPath%>/scripts/highslide/highslide-full.js"></script>
<script type="text/javascript" src="<%=contextPath%>/scripts/highslide.js"></script>

<script type="text/javascript"> 
hs.graphicsDir = '<%=contextPath%>/scripts/highslide/graphics/';
</script>
<%} %>
<script type="text/javascript" src="<%=contextPath%>/scripts/jquery.js"></script>
<script type="text/javascript">
$(function(){
	$("tr:odd").each(function(i, o){
		o = $(o);
		o.css("font-size", "larger").css("font-weight ", "bold");
		o.css("padding-right", "5px");
		o.css("color", "blue");
		o.attr("align", "right");
	});
});
</script>
<style type="text/css">
 html,body{
      margin:0;
      padding:0;
      height:100%;
      border:none;
      overflow:hidden;
}
td {
	height:34px;
	background:#F8F8F8 url(<%=contextPath%>/images/row_bg.png) repeat-x scroll 0 100%;
	font-size:14px;
	padding-left:5px;
}
</style>
</head>
<body marginwidth="0" marginheight="0" leftmargin="0" topmargin="0">

<table width="100%" cellpadding="0" border="0">
	<tr>
		<td>
			房间号:
		</td>
<%
if (detail) {
%>
		<td rowspan="100" width="90%" valign="top" style="border:1px solid #cccccc;">
<div class="hidden-container">
<%
	String imagePath = contextPath + "/images/room/";
	String[] images = {
			"01.jpg", "02.jpg", 
			"03.jpg", "04.jpg", 
			"05.jpg", "06.jpg", 
	};
	for (int i=0; i<images.length; i++) {
		String id = i==0 ? "id=\"thumb1\" " : "";
		String path = imagePath + images[i];
%> 
	<a <%=id%>class='highslide' href='<%=path%>' onclick="return hs.expand(this, inPageOptions)">
		<img height="" src='<%=path%>' alt='<%=images[i] %>'/>
	</a>
<%
	}
%>
</div>
<div id="gallery-area" style="width: 100%; height: 100%; margin: 0 auto;float:right;"></div>
		</td>
<%} %>

	</tr>
	<tr>
		<td>
			<%=room.getName() %>
		</td>
	</tr>
	<tr>
		<td>
			房间类型:
		</td>
	</tr>
	<tr>
		<td>
			<%=room.getType().getName() %>
		</td>
	</tr>
	<tr>
		<td>
			单价(元/天):
		</td>
	</tr>
	<tr>
		<td>
			<%=Utils.toPrice(room.getType().getPrice()) %>
		</td>
	</tr>
	<tr>
		<td>
			会员价(元/天):
		</td>
	</tr>
	<tr>
		<td style="color:red;"><!-- TODO 查询会员价 -->
			<%=Utils.toPrice(memberPrice) %>
		</td>
	</tr>
</table>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" style="margin:0;padding:0;border:0px solid red;">
	<tr>
		<td width="300px" valign="top" style="border:1px solid #cccccc;">
		</td>
	</tr>
</table>

</body>
</html>
<%} %>
